<?php

namespace app\system\controller\system;

use app\common\controller\System;
use think\facade\Db;

/**
 * 子站管理
 *
 */
class Basic extends System {
    /**
     * Substation模型对象
     * @var \app\admin\model\system\Substation
     */



    public function initialize():void {
        parent::initialize();
    }

    public function setInfo(){
        $params = $this->request->param();
        foreach($params as $key => $val){
            $val = empty($val) ? null : $val;
            db::name('options')->where(['name' => $key, 'filter_id' => $this->filter['id']])->update(['content' => $val]);
        }
        $this->success();
    }

    public function getInfo(){
        $options = Db::name('options')->where(['filter_id' => $this->filter['id']])->select();
        $data = [];
        foreach($options as $val){
            $data[$val['name']] = $val['content'];
        }
        $this->success('', $data);
    }


    /**
     * 若需重写查看、编辑、删除等方法，请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写
     */
}